package com.ymatou.iapi.csim.testcase;

import java.util.List;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.csim.parameter.DiscourseDto;
import com.ymatou.iapi.csim.parameter.FetchAllIndividualDiscourseCategoryBean;
import com.ymatou.iapi.csim.parameter.SaveOrUpdateIndividualDiscourseBean;
import com.ymatou.iapi.csim.service.FetchAllIndividualDiscourseCategoryCall;
import com.ymatou.iapi.csim.service.SaveOrUpdateIndividualDiscourseCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.CsimCallService;
import com.ymttest.database.model.ymt_individualdiscoursecatetory;
import com.ymttest.database.sqlwapper.CSIM.ymt_individualdiscourseWapper;
import com.ymttest.database.sqlwapper.CSIM.ymt_individualdiscoursecatetoryWapper;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.TestDataManager;
/**
*获取所有个人话术分类列表
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_FetchAllIndividualDiscourseCategory{
	private static FetchAllIndividualDiscourseCategoryBean bean;
	private static FetchAllIndividualDiscourseCategoryCall call;
	private Integer csId=Integer.parseInt(EnvSetup.getData("csId").toString());
	private ymt_individualdiscoursecatetoryWapper individualdiscoursecatetoryWapper=new ymt_individualdiscoursecatetoryWapper();
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("获取所有个人话术分类列表");
	}

	@Before
	public void caseUp() {
		bean=new FetchAllIndividualDiscourseCategoryBean();
		call=new FetchAllIndividualDiscourseCategoryCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(call.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_FetchAllIndividualDiscourseCategory_001() {
		Logger.start(true,"获取所有个人话术分类列表");
		try {
			
			bean.setCsId(csId);
			call.setData(bean);
			call.callService();		
			List<DiscourseDto> callList=call.getData().getResult();
			List<ymt_individualdiscoursecatetory>  list=individualdiscoursecatetoryWapper.selectByCSId(bean.getCsId());
			for(int i=0;i<list.size();i++)
			{
				Logger.verifyEquals(callList.get(i).getCategoryId(), list.get(i).getCategoryId(), "验证ymt_discoursecategory表第"+(i+1)+"条ymt_discoursecategory表第"+(i+1)+"条字段CategoryId");
				Logger.verifyEquals(callList.get(i).getTitle(), list.get(i).getTitle(), "验证ymt_discoursecategory表第"+(i+1)+"条Title");
				Logger.verifyEquals(callList.get(i).getCsId(), list.get(i).getCSId(), "验证ymt_discoursecategory表第"+(i+1)+"条CsId");
				Logger.verifyEquals(callList.get(i).getSort(), list.get(i).getSort(), "验证ymt_discoursecategory表第"+(i+1)+"条Sort");
			}
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}